package com.service.impl;

import com.dao.UserMapper;
import com.model.User;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper mapper;
    @Override
    public User getUserByIdByPass(String userId, String password) {
        User user=null ;
        try {
          user = mapper.getUserByIdByPass(userId, password);
        }catch (Exception e){
            e.printStackTrace();
        }
        return user;
    }

    @Override
    public int getUserById(String userId) {
        int index=-1;
        try {
            index=mapper.getUserById(userId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return index;
    }

    @Override
    public int saveUser(String userId, String password, String userName, int userSex) {
        int issave=-1;
        try {
            issave=mapper.saveUser(userId,password,userName,userSex);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return issave;
    }
}
